package review;

import java.lang.reflect.Field;

public class HookTest {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
        Class<?> ATMClass = Class.forName("android.app.ActivityTaskManager");

        Field IActivityTaskManagerSingletonField = ATMClass.getDeclaredField("IActivityTaskManagerSingleton");
        IActivityTaskManagerSingletonField.setAccessible(true);
        Object IActivityTaskManagerSingleton = IActivityTaskManagerSingletonField.get(null);

        Class<?> SingletonClass = Class.forName("android.util.Singleton");
        Field mInstanceField = SingletonClass.getDeclaredField("mInstance");
        mInstanceField.setAccessible(true);

        // 原始的IATM
        final Object rawIATM = mInstanceField.get(IActivityTaskManagerSingleton);
        System.out.println(rawIATM);
    }
}
